package jy.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Store entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "store", catalog = "waimai")
public class Store implements java.io.Serializable {

	// Fields

	private Integer id;
	private User user;
	private String name;
	private String storeName;
	private String address;
	private String tel;
	private String otel;
	private String servicetime;
	private Float mincost;
	private Float deliveryscost;
	private String info;
	private String image;
	private Set<Ftype> ftypes = new HashSet<Ftype>(0);
	private Set<Food> foods = new HashSet<Food>(0);
	private Set<Order> orders = new HashSet<Order>(0);

	// Constructors

	/** default constructor */
	public Store() {
	}

	/** minimal constructor */
	public Store(User user, String name, String address, String tel,
			String otel, String servicetime, Float mincost,
			Float deliveryscost, String info) {
		this.user = user;
		this.name = name;
		this.address = address;
		this.tel = tel;
		this.otel = otel;
		this.servicetime = servicetime;
		this.mincost = mincost;
		this.deliveryscost = deliveryscost;
		this.info = info;
	}

	/** full constructor */
	public Store(User user, String name, String storeName, String address,
			String tel, String otel, String servicetime, Float mincost,
			Float deliveryscost, String info, String image, Set<Ftype> ftypes,
			Set<Food> foods, Set<Order> orders) {
		this.user = user;
		this.name = name;
		this.storeName = storeName;
		this.address = address;
		this.tel = tel;
		this.otel = otel;
		this.servicetime = servicetime;
		this.mincost = mincost;
		this.deliveryscost = deliveryscost;
		this.info = info;
		this.image = image;
		this.ftypes = ftypes;
		this.foods = foods;
		this.orders = orders;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "name", nullable = false, length = 40)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "store_name", length = 40)
	public String getStoreName() {
		return this.storeName;
	}

	public void setStoreName(String storeName) {
		this.storeName = storeName;
	}

	@Column(name = "address", nullable = false, length = 100)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "tel", nullable = false, length = 20)
	public String getTel() {
		return this.tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	@Column(name = "otel", nullable = false, length = 20)
	public String getOtel() {
		return this.otel;
	}

	public void setOtel(String otel) {
		this.otel = otel;
	}

	@Column(name = "servicetime", nullable = false, length = 20)
	public String getServicetime() {
		return this.servicetime;
	}

	public void setServicetime(String servicetime) {
		this.servicetime = servicetime;
	}

	@Column(name = "mincost", nullable = false, precision = 12, scale = 0)
	public Float getMincost() {
		return this.mincost;
	}

	public void setMincost(Float mincost) {
		this.mincost = mincost;
	}

	@Column(name = "deliveryscost", nullable = false, precision = 12, scale = 0)
	public Float getDeliveryscost() {
		return this.deliveryscost;
	}

	public void setDeliveryscost(Float deliveryscost) {
		this.deliveryscost = deliveryscost;
	}

	@Column(name = "info", nullable = false, length = 500)
	public String getInfo() {
		return this.info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	@Column(name = "image", length = 40)
	public String getImage() {
		return this.image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "store")
	public Set<Ftype> getFtypes() {
		return this.ftypes;
	}

	public void setFtypes(Set<Ftype> ftypes) {
		this.ftypes = ftypes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "store")
	public Set<Food> getFoods() {
		return this.foods;
	}

	public void setFoods(Set<Food> foods) {
		this.foods = foods;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "store")
	public Set<Order> getOrders() {
		return this.orders;
	}

	public void setOrders(Set<Order> orders) {
		this.orders = orders;
	}

}